﻿#ifndef IMAGECAROUSEL_H
#define IMAGECAROUSEL_H

#include <QGraphicsView>
#include<QGraphicsScene>
#include <QGraphicsRectItem>
#include<QGraphicsPixmapItem>
#include<QList>
#include<QPixmap>
#include <QTimer>
#include<QDebug>
#include<imagetools.h>
#include <QLabel>



class ImageCarousel : public QGraphicsView
{
    Q_OBJECT
public:
    ImageCarousel(QWidget *parent = nullptr);
    void setImageList(const QList<QPixmap> &images);
    void startCarousel(int interval = 3000);
    void stopCarousel();




public slots:
    void showNextImage();

private:    
    QLabel *pixmapItem;
    QList<QPixmap> images;
    QTimer *timer;

    int currentIndex; // 当前图片下标

    int width;  // 图形宽度
    int height; //图形高度
};

#endif // IMAGECAROUSEL_H
